home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-10-30 | 811 b | 43 lines | [TEXT/KEEN] |
- #$StubFunctions
- #given protos such as
- #int f(long y);
- #long g(char x, Ptr z);
- #etc
- #produce
- #int f(long y)
- # {
- #
- # }
- #
- #long g(char x, Ptr z)
- # {
- #
- # }
- #etc
-
- #Typical run: select the prototypes in some text window; run this
- #program taking input from "Front text selection", with both
- #"Show stdout" and "Select stdout" checked; Copy the results shown
- #in stdout, and Paste them into your file.
-
- #For simplicity, comments between protos not handled properly
-
- /./ {
- n = 0
- x[0] = $0
- while (x[n] != "" && !match(x[n], /;/))
- {
- getline x[++n]
- }
- gsub(/\(void\)/, "()");#optional, remove "void" from brackets
- # paste in a starting comment
- print "/* */"
- for (i = 0; i <= n; ++i)
- {
- if (i == n)
- gsub(/;/, "", x[n])#strip semicolon
- print x[i]
- }
- print "\t{\n\t\n\t}\n" #print the function body
- }
-